<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>注册页面</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="javascript/jQuery.js"></script>
<script type="text/javascript">
	function checkUserNameUnic() {  
	var loginName = document.getElementById("userName").value;
	if (loginName == "" || loginName == null) {  
	   alert('用户名不能为空！');  
	   return false;  
	} else {  
	   var url = "checkuser/checkUsername.action?userDto.userName=" + loginName;  
	   send(url);  
	   // document.myform.action = "action.do?method=checkLoginName";  
	   // document.myform.submit();  
	}  
	}  
	var xmlHttp;  
	function createXmlHttp() {  
	  
	if (window.XMLHttpRequest) {  
	   xmlHttp = new XMLHttpRequest();  
	} else if (window.ActiveXObject) {  
	   xmlHttp = new ActiveXObject("MIcrosoft.XMLHttp");  
	}  
	}  
	  
	function send(url) {  
	createXmlHttp();  
	xmlHttp.open("GET", url, true);  
	xmlHttp.onreadystatechange = processRequest;  
	xmlHttp.send(null);  
	}  
	  
	function processRequest() {  
	if (xmlHttp.readyState == 4) {  
	   if (xmlHttp.status == 200) {  
	      
	    var text = xmlHttp.responseText;  
	    document.getElementById("chkunic").innerHTML = text;
	   }  
	}  
	  
	} 
</script>

<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>

<body>
	<div align="center">
		<form id="form1" action="user/registerUser.action" method="post" >
			<I><font face="楷体_GB2312" color="#FF0000"><s:fielderror />
			</font> </I>
			<!-- 读取显示提示信息 -->
			<table>
				<tr>
					<td>用户名:</td>
					<td><input type="text" id="userName" name="userDto.userName"
						value="<s:property value='userDto.userName' />" onblur="checkUserNameUnic();" />
						<span id="chkunic"></span>
					</td>
				</tr>
				<tr>
					<td>密码:</td>
					<td><input type="password" name="userDto.password" /></td>
				</tr>
				<tr>
					<td>确认密码:</td>
					<td><input type="password" name="userDto.rePassword" /></td>
				</tr>
	
				<tr>
					<td>年龄:</td>
					<td><input type="text" name="userDto.age"
						value="<s:property value='userDto.age' />" /></td>
				</tr>
				<tr>
					<td>生日:</td>
					<td><input type="text" name="userDto.birthday"
						value="<s:property value='userDto.birthday' />" />格式形如：1989-09-23</td>
				</tr>
				<tr>
					<td>验证码</td>
					<td><input type="text" name="captchacode"
						vaule="<s:property value='captchacode' />" /> <a id="a_ref"
						href="javascript:void(0)"
						onclick="document.getElementById('form1').submit()"><img
							id="img_c" src="captcha.action" />
					</a> <SCRIPT type="text/javascript">
							$('#a_ref').observe('click', function() {
								var timenow = new Date().getTime();
								$('img_c').src = "captcha.action?d=" + timenow;
							})
						</SCRIPT>
					</td>
				</tr>
				<tr>
					<td colspan="2"><s:submit value="注册"></s:submit></td>
				</tr>
			</table>
			<s:debug></s:debug>
		</form>
	</div>
</body>
</html>
